Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed some console errors for standard user #12479

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eva-vashkevich
Copy link
Member

@eva-vashkevich eva-vashkevich commented Nov 1, 2024

Summary

Fixes #12478

Added some error catching to

  • node drivers
  • pod security admissions
  • edit YAML for fleet git repos

Occurred changes and/or fixed issues

Technical notes summary

Areas or cases that should be tested

Create a new standard user with this custom roles:
{ resource: "fleetworkspaces", verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]},
{ resource: "gitrepos", verbs: ["list"]},
{ resource: "bundles", verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]},

Log in as this user.
Going to the following pages shouldn't throw any errors in the console:
Cluster management -> Advanced -> Pod Security Admissions
Cluster management -> Drivers -> Node Drivers

Continuous delivery -> Git repos -> Edit YAML for existing git repo should open with an error banner

Areas which could experience regressions

None

Screenshot/Video

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes

Comment on lines +215 to +231
try {
model = await store.dispatch(`${ inStore }/clone`, { resource: liveModel });
} catch (e) {
this.errors.push(e);
}
}
try {
initialModel = await store.dispatch(`${ inStore }/clone`, { resource: liveModel });
} catch (e) {
this.errors.push(e);
}

initialModel = await store.dispatch(`${ inStore }/clone`, { resource: liveModel });

if ( as === _YAML ) {
yaml = await getYaml(this.$store, liveModel);
try {
yaml = await getYaml(this.$store, liveModel);
} catch (e) {
this.errors.push(e);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we can wrap all of these statements into a single try...catch block:

      try {
        if (realMode === _VIEW) {
          model = liveModel;
        } else {
          model = await store.dispatch(`${ inStore }/clone`, { resource: liveModel });
        }

        initialModel = await store.dispatch(`${ inStore }/clone`, { resource: liveModel });

        if ( as === _YAML ) {
          yaml = await getYaml(this.$store, liveModel);
        }
      } catch (e) {
        this.errors.push(e);
      }

model = await store.dispatch(`${ inStore }/cleanForDetail`, model);
try {
model = await store.dispatch(`${ inStore }/cleanForDetail`, model);
} catch (e) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we intentionally performing a noop in the catch block?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors thrown in console for some components if user doesn't have permissions
2 participants